package com.sbt.demo.config;


import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource {

	@Override
	protected Object determineCurrentLookupKey() {
		String dataSourceKey = DynamicDataSourceHolder.getDataSouce();
		if(dataSourceKey==null){
			dataSourceKey = DataSourceConfig.DEFAULT_DATASOURCE;
		}
		return dataSourceKey;
	}

}